package config

import models.Tables.QtlRow
import play.api.libs.json.{JsObject, Json}

object QTL extends MyFile {

  def getQtlSvgData(qtl: Seq[QtlRow]) = {
    val height = Seq("33288019", "35008273", "41698299", "31152864", "33752483", "32362979", "23759298")
    val heightJson = height.zipWithIndex.map { case (len, i) =>
      Json.obj("key" -> ("Chr" + (i + 1)), "value" -> len)
    }
    val gen = qtl.map { q =>
      Json.obj("name" -> q.qtlId, "chr" -> ("Chr" + q.chr), "length" -> q.length, "start" -> q.left,"end" -> q.right,
        "id" -> q.id,"trait" -> q.`trait`,"m5c" -> q.m5c,"m6a" -> q.m6a,"total" -> q.total)
    }
    Json.obj("height" -> heightJson, "gen" -> gen)
  }


}
